Add User Variables

AUTHORallows you to create and manipulate User-defined variables. As the name suggests, Variables are named objects that may change or vary in value when the lesson is run. You will have already used variables if you have defined Conditions in the Response section of an Element. The most commonly used variable is the ANSWER variable which contains the value of the student’s answer.

For example, if you created a Multiple Choice question with 4 buttons (e.g. A, B, C and D) you would have entered a Value for each of the buttons (you may decide to assign the buttons the Values of A,B,C and D respectively). This is how AUTHORidentifies which of the buttons the student selected. The Value of the student’s answer is stored in the ANSWER variable. If the student responds to the question by pressing the C button, the ANSWER variable will contain the Value of the pressed button, C.


System Variables

The variables that are built-in to AUTHORare called System variables. Examples of System variables are FIRSTNAME, LASTNAME, TIME, DAY, MONTH, YEAR, CORRECT and INCORRECT. The Value and name of these variables is determined by AUTHOR™  (not by you). You may display the Value  of these variables in Text or Feature text within your multimedia module by using square brackets around the name of the System variable.

E.g. If you place the text below in a Text or Feature text action:

Congratulations [FIRSTNAME] you have passed!

If Teresa Roberts runs this lesson from the Training Management System she will see

Congratulations Teresa you have passed!

when she runs the lesson.

See System Variables for additional information.


Creating user-defined variables

User-defined variables  allow you to make your own variables, perform operations on them and use them to determine whether certain Actions in an Element should occur. The simplest use of User-defined variables is to store student responses for later use in the lesson.

To start creating and manipulating variables you need to add a Variable action to your Action list.

  •  Click to highlight the position in the Action list where you would like to position the variable
  •  Click the Variable action button on the Action toolbar.

The User defined variables  dialog will then appear.  This is where you can create new user defined variables and assign values to them.

 

To create a new User defined variable click on the New button to the right of the User variables list. The New button has a picture of a blank page on it. This displays the Create a new variable dialog box.

Type a name for your variable into the Name field. The name of the variable should be meaningful. For example, if you are creating a variable that will be used to store the age of the trainee then using a name like VariableOne does not tell us much about the purpose of this variable. However, naming the variable TraineeAge means that we instantly know what that variable is used for.

Bookmark allows the variable to persist through sessions using browser cookies.  Bookmarked variables will be read when a lesson starts and saved when a lesson stops.

You can also supply a Description for the variable providing even more detailed information about the purpose and use of this variable. Once you have created the variable, the description is displayed whenever you highlight the variable in the User variables list in the User defined variables dialog box.

Finally, you need to specify the type of your new variable by selecting either Number or Text in the Type of variable frame. If the variable does not need to have numeric operations performed on it then define it as text.

Once you have created a variable you can assign a value to it. You can of course simply type in a literal value for the variable such as INTROVERTED or 345. However you may also assign the value of other variables such as ANSWER or DATE or any other User defined variable you have created. The available variables are displayed in the User variables and System Variables list. Simply highlight the variable and press the insert button at the top of the list. The variable will appear in the Expression list.

The Expression List can contain the value of other variables by adding their name in square brackets, arithmetic operators or functions and will concatenate strings by default.

The Functions list will display either numeric or text functions that you may use to manipulate the values in the expression list. You will notice that you may perform a variety of common numeric functions such as SIN COS etc, while the text functions allow you to strip spaces or extract characters from the existing text. The use of these functions to build expressions requires some knowledge of programming.

You may set a variable to any combination of literal values, strings and the value of other variables.

CHR(integer) Returns a string character based on the number specify

UCASE(string) Returns a string in upper case

LCASE(string) Returns a string in lower case

TRIM(string) Trims white space from the beginning and end of a string

LEN(string) Returns the length of a string

LEFT(string,int chars) Returns a string containing a specified number of characters from the left side of a string

RIGHT(string,int chars) Returns the string containing a specified number of characters from the right side of a string

INSTR(int start,string,sstring) Returns and integer specifying the start position of the first occurrence of  sstring within string

MID(string, start, howmany) Returns a string starting at the position specified with the characters specified

RND(first, last) Returns a random number or a random number between two numbers

INT(string) Returns an integer based on the string

SECONDS_TO_TIME(integer seconds) Returns the hour minutes and seconds for the specified seconds

ROUND(number, [decimal]) Returns a value rounded to the nearest integral value or to a specified number of fractional digits

SUM(X1,X2,X3....) Returns the sum of all the numbers specified

MAX(number,number) Returns the larger of 2 numbers

MIN(number,number) Returns the smaller of 2 numbers

ABS(number) Returns the absolute value of a number

ATN(radians)  Returns the arc tangent of a number as a value between mine as -PI/2 and PI/2 radians

COS(radians) Returns the cosine of the specified angle

EXP(number) Returns E the base of natural logarithms raised to the specified power

LOG(number) Returns the natural base E logarithm of a specified number

SGN(number) Returns An integer value indicating the sign of a number

SIN(radians)Returns the sign of the specified angle

SQR(number) Returns the square root of a specified number

TAN(radians) returns the tangent of the specified angle


Dialog controls

See  The Action Toolbar  for information about the dialog controls displayed at the bottom of the dialog box.